﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ResourceLoader : MonoBehaviour
{
    public static Dictionary<CardBelongType, GameObject> cardBelongPrefabMap = new Dictionary<CardBelongType, GameObject>();

    public static CardCategoryScriptable cardCategory;

    private void Awake()
    {
        if (GameObject.FindObjectsOfType<ResourceLoader>().Length > 1)
        {
            Destroy(this);
        }
        else
        {
            DontDestroyOnLoad(this);
        }
        
        
        foreach (CardBelongType belongType in Enum.GetValues(typeof(CardBelongType)))
        {
            cardBelongPrefabMap[belongType] = Resources.Load<GameObject>($"Prefabs/Card/{belongType.ToString()}CardTemplate");
        }
        
        cardCategory = Resources.Load<CardCategoryScriptable>("Scriptable/EntityData/CardCategory");
    }
}
